package modul

import "gitee.com/yutiandou/wdtools/wdstruct"

var recvivinfo = wdstruct.NewObjectPool(2048,new(ReceiveInfo))
func GetRecvinfo()*ReceiveInfo{
	return recvivinfo.Get().(*ReceiveInfo)
}
func GiveRecvinfo(rec *ReceiveInfo){
	recvivinfo.Give(rec)
}
type ReceiveInfo struct{
	Message ReceiveMsg `json:"message"`
	WCID string `json:"wcId"`
}

func (r * ReceiveInfo)New()interface{}{
	return new(ReceiveInfo)
}
func (r * ReceiveInfo)Recycle(obj  interface{}){
	ptr:= obj.(*ReceiveInfo)
	ptr.WCID = ""
	ptr.Message.MessageType = -1
	//ptr.Message.Data.MsgType = -1
}

type ReceiveMsg struct {
	Data interface{} `json:"data"`
	MessageType int `json:"messageType"`
}
type ReceiveData struct {
	MsgType int `json:"msgType"`
	ToUser string `json:"toUser"`
	Timestamp int64 `json:"timestamp"`
	Content string `json:"content"`
	Img []byte `json:"img"`
	Self bool `json:"self"`
	Type int `json:"type"`
	Category int `json:"category"`
	MsgId int64 `json:"msgId"`
	Atlist []string `json:"atlist"`
	MsgSource string `json:"msgSource"`
	PushContent string `json:"pushContent"`
	FromUser string `json:"fromUser"`
	FromGroup string `json:"fromGroup"`
}
var recvivdata = wdstruct.NewObjectPool(1024,new(ReceiveData))
func GetRecvdata()*ReceiveData{
	return recvivdata.Get().(*ReceiveData)
}
func GiveRecvdata(rec *ReceiveData){
	recvivdata.Give(rec)
}
func (r * ReceiveData)New()interface{}{
	return new(ReceiveData)
}
func (r * ReceiveData)Recycle(obj  interface{}){
	ptr:= obj.(*ReceiveData)
	ptr.MsgId = 0
	ptr.Type = 0
	ptr.Content = ""
	ptr.ToUser = ""
	ptr.FromUser = ""
	//ptr.Message.Data.MsgType = -1
}

type VoiceDown struct {
	WID string `json:"wId"`
	MsgId int64 `json:"msgId"`
	Length int `json:"length"`
}